package users

import (
	"context"

	v1 "star/api/users/v1"
	"star/internal/logic/users"
)

func (c *ControllerV1) Login(ctx context.Context, req *v1.LoginReq) (res *v1.LoginRes, err error) {
	ResUSER, err := users.Login(ctx, req.Username, req.Password)
	if err != nil {
		return
	}
	return &v1.LoginRes{
		Username: ResUSER.Username,
		Email:    ResUSER.Email,
		Token:    ResUSER.Token,
	}, nil
}
